[bits 32]

section .text;代码段

global inb;将inb导出
inb:
    push   ebp
    mov    ebp,esp

    xor eax,eax;将eax置0
    mov edx,[ebp+8];port
    in al,dx;将端口号位为dx的8bit输入到al

    jmp $+2
    jmp $+2
    jmp $+2

    leave;恢复堆栈
    ret

global outb;将inb导出
outb:
    push   ebp
    mov    ebp,esp

    mov edx,[ebp+8];port
    mov eax,[ebp+12];value
    out dx,al

    jmp $+2
    jmp $+2
    jmp $+2

    leave;恢复堆栈

    ret


global inw
inw:
    push   ebp
    mov    ebp,esp

    xor eax,eax;将eax置0
    mov edx,[ebp+8];port
    in ax,dx;将端口号位为dx的8bit输入到ax

    jmp $+2
    jmp $+2
    jmp $+2

    leave;恢复堆栈
    ret

global outw;将inb导出
outw:
    push   ebp
    mov    ebp,esp

    mov edx,[ebp+8];port
    mov eax,[ebp+12];value
    out dx,ax

    jmp $+2
    jmp $+2
    jmp $+2

    leave;恢复堆栈
    ret

